A generalized version of density dependence has been introduced into the M3Y effective nucleon-nucleon $(\mathrm{NN})$ interaction that was based on the $G$-matrix elements of the Paris $\mathrm{NN}$ potential. The density dependent parameters have been chosen to reproduce the saturation binding energy and density of normal nuclear matter within a Hartree-Fock scheme, but with various values for the corresponding nuclear incompressibility $K$ ranging from 176 to 270 MeV. We use these new density dependent interactions in the folding model to calculate the real parts of $\ensuremath{\alpha}$-nucleus and nucleus-nucleus optical potentials for those systems where strongly refractive scattering patterns have been observed. These provide some information on the potentials at short distances, where there is a strong overlap of the projectile and target density distributions, and hence where the density dependence of the interaction plays an important role. We try to infer, from careful optical model (OM) analyses, the sensitivity of the scattering data to different $K$ values. Results obtained for elastic $\ensuremath{\alpha}$ scattering on targets ranging from ${}^{12}$C to ${}^{208}$Pb allow us to determine unambiguously that the $K$ value favored in this approach is within the range of 240 to 270 MeV. Similar OM analyses have also been done on measurements of the elastic scattering of ${}^{12}$C+${}^{12}$C, ${}^{16}$O+${}^{12}$C, and ${}^{16}$O+${}^{16}$O at incident energies up to 94 MeV/nucleon. These data were found to be much less sensitive over such a narrow range of $K$ values. This lack of sensitivity is due mainly to the smaller maximum overlap density which occurs for these systems, compared to that which is formed in an $\ensuremath{\alpha}$-nucleus collision. This makes the effects of density dependence less substantial. Another reason is that a small difference between two folded heavy ion potentials can often be compensated for, in part, by a small overall renormalization of one of them. This renormalization is often allowed in optical model analyses, and interpreted, for example, as accounting for a contribution from a higher-order dynamic polarization potential. In an attempt to avoid this ambiguity, some OM analyses of the extensive and accurate data for ${}^{16}$O+${}^{16}$O scattering were done using the unrenormalized folded potentials, together with the explicit addition of a correction term, expressed in terms of cubic splines. This correction term can be interpreted as representing a contribution to the real potential from the dynamic polarization potential. The results of such a ``folding+spline'' analysis suggest a tendency to favor the same $K$ value range that was found in the OM analyses of $\ensuremath{\alpha}$-nucleus scattering.