The elastic constant C-11 and piezoelectric stress constant e(1),(11) of two-dimensional (2D) dielectric materials comprising h-BN, 2H-MoS2, and other transition-metal dichalcogenides and dioxides are calculated using lattice dynamical theory. The results are compared with corresponding quantities obtained with ab initio calculations. We identify the difference between clamped-ion and relaxed-ion contributions with the dependence on inner strains which are due to the relative displacements of the ions in the unit cell. Lattice dynamics allows us to express the inner-strain contributions in terms of microscopic quantities such as effective ionic charges and optoacoustical couplings, which allows us to clarify differences in the piezoelectric behavior between h-BN and MoS2. Trends in the different microscopic quantities as functions of atomic composition are discussed.