We introduce a density functional formalism to study the ground-state properties of stronglycorrelated dipolar and ionic ultracold bosonic and fermionic gases, based on the self-consistent combination of the weak and the strong coupling limits. Contrary to conventional density functional approaches, our formalism does not require a previous calculation of the interacting homogeneous gas, and it is thus very suitable to treat systems with tunable long-range interactions. Due to its asymptotic exactness in the regime of strong correlation, the formalism works for systems in which standard mean-field theories fail.Introduction -In contrast with its widespread use and success in areas as diverse as quantum chemistry [1], materials science [2] or semiconductor nanostructures [3], Density Functional Theory (DFT) has received relatively little attention in the very active field of ultracold atomic gases. It is well known that the Hohenberg-Kohn theorems, originally formulated in terms of the electron gas [4,5], hold for both fermionic and bosonic systems, as well as for interactions different than the Coulomb one. However, the lack of adequate density functionals has hindered the role of DFT in the study of ultracold atomic gases in favour of other well-established approaches, such as the widely used Gross-Pitaevskii (GP) method in the case of Bose gases. The latter is a mean-field approach and does not allow treating the effect of correlations, which play a crucial role in many different phenomena occurring in ultracold quantum gases [6]. One then often turns to configuration-interaction (CI), quantum Monte Carlo (QMC) or Green's-function methods (for recent reviews, see, e.g., Refs. 6-8).