Recently there has been renewed interest in second sound in superfluid Bose and Fermi gases. By using two-fluid hydrodynamic theory, we review the density response $chi_{nn}(bq,omega)$ of these systems as a tool to identify second sound in experiments based on density probes. Our work generalizes the well-known studies of the dynamic structure factor $S(bq,omega)$ in superfluid $^4$He in the critical region. We show that, in the unitary limit of uniform superfluid Fermi gases, the relative weight of second vs. first sound in the compressibility sum rule is given by the Landau--Placzek ratio $lpequiv (bar{c}_p-bar{c}_v)/bar{c}_v$ for all temperatures below $T_c$. In contrast to superfluid $^4$He, $lp$ is much larger in strongly interacting Fermi gases, being already of order unity for $T sim 0.8 T_c$, thereby providing promising opportunities to excite second sound with density probes. The relative weights of first and second sound are quite different in $S(bq,omega)$ (measured in pulse propagation studies) as compared to $mathrm{Im}chi_{nn}(bq,omega)$ (measured in two-photon Bragg scattering). We show that first and second sound in $S(bq,omega)$ in a strongly interacting Bose-condensed gas are similar to those in a Fermi gas at unitarity. However, in a weakly interacting Bose gas, first and second sound are mainly uncoupled oscillations of the thermal cloud and condensate, respectively, and second sound has most of the spectral weight in $S(bq,omega)$. We also discuss the behaviour of the superfluid and normal fluid velocity fields involved in first and second sound.