We derive the stellar-to-halo mass relation (SHMR), namely f⋆ ∝ M⋆/Mh versus M⋆ and Mh, for early-type galaxies from their near-infrared luminosities (for M⋆) and the position-velocity distributions of their globular cluster systems (for Mh). Our individual estimates of Mh are based on fitting a flexible dynamical model with a distribution function expressed in terms of action-angle variables and imposing a prior on Mh from the correlation between halo concentration and mass in the standard Λ cold dark matter (ΛCDM) cosmology. We find that the SHMR for early-type galaxies declines with mass beyond a peak at M⋆ ∼ 5 × 1010 M⊙ and Mh ∼ 1 × 1012 M⊙ (near the mass of the Milky Way). This result is consistent with the standard SHMR derived by abundance matching for the general population of galaxies, and also with previous, less robust derivations of the SHMR for early-type galaxies. However, it contrasts sharply with the monotonically rising SHMR for late-type galaxies derived from extended HI rotation curves and the same ΛCDM prior on Mh that we adopt for early-type galaxies. We show that the SHMR for massive galaxies varies more or less continuously with disc fraction and Hubble type between these rising and falling branches. We also show that the different SHMRs for late-type and early-type galaxies are consistent with the similar scaling relations between their stellar velocities and masses (the Tully–Fisher and the Faber–Jackson relations). As we demonstrate explicitly, differences in the relations between the stellar and halo virial velocities account for the similarity of the scaling relations. We argue that all these empirical findings are natural consequences of a picture in which galactic discs are built mainly by relatively smooth and gradual inflow, regulated by feedback from young stars, while galactic spheroids are built by a combination of merging, black-hole fuelling, and feedback from active galactic nuclei.