Elliptical (E) and spiral (S) galaxies follow tight, but different, scaling laws that link their stellar masses, radii, and characteristic velocities. Mass and velocity, for example, scale tightly in spirals with little dependence on galaxy radius (the "Tully-Fisher relation"; TFR). On the other hand, ellipticals appear to trace a 2D surface in size-mass-velocity space (the "Fundamental Plane"; FP). Over the years, a number of studies have attempted to understand these empirical relations, usually in terms of variations of the virial theorem for E galaxies and in terms of the scaling relations of dark matter halos for spirals. We use Lambda cold dark matter (LCDM) cosmological hydrodynamical simulations to show that the scaling relations of both ellipticals and spirals arise as the result of (i) a tight galaxy mass-dark halo mass relation and (ii) the self-similar mass profile of cold dark matter halos. In this interpretation, E and S galaxies of a given stellar mass inhabit halos of similar masses, and their different scaling laws result from the varying amounts of dark matter enclosed within their luminous radii. This scenario suggests a new galaxy distance indicator applicable to galaxies of all morphologies and provides simple and intuitive explanations for long-standing puzzles, such as why the TFR is independent of surface brightness, or what causes the "tilt" in the FP. Our results provide strong support for the predictions of LCDM in the strongly non-linear regime, as well as guidance for further improvements to cosmological simulations of galaxy formation.