We introduce a dissipative particle dynamics scheme for the dynamics of nonideal fluids. Given a free-energy density that determines the thermodynamics of the system, we derive consistent conservative forces. The use of these effective, density dependent forces reduces the local structure as compared to previously proposed models. This is an important feature in mesoscopic modeling, since it ensures a realistic length and time scale separation in coarse-grained models. We consider in detail the behavior of a van der Waals fluid and a binary mixture with a miscibility gap. We discuss the physical implications of having a single length scale characterizing the interaction range, in particular for the interfacial properties.