  Large fractions of metals are missing from the observable gas-phase in the
interstellar medium (ISM) because they are incorporated into dust grains, a
phenomenon called dust depletion. The study of dust depletion in the ISM is
important to investigate the origin and evolution of metals and cosmic dust.
Here we aim at characterizing the dust depletion of several metals from the
Milky Way to distant galaxies. We collect ISM metal column densities from
absorption-line spectroscopy in the literature, and in addition, we determine
Ti and Ni column densities from a sample of 70 damped Lyman-$\alpha$ absorbers
(DLAs) towards quasars, observed with UVES/VLT. We use ISM relative abundances
to estimate the dust depletion of 18 metals (C, P, O, Cl, Kr, S, Ge, Mg, Si,
Cu, Co, Mn, Cr, Ni, Al, Ti, Zn and Fe) for different environments (the Milky
Way, the Magellanic Clouds (MCs), DLAs towards quasars and towards gamma-ray
bursts). We observe linear relations between the depletion of each metal and
the strength of dust depletion, which we trace with the observed [Zn/Fe]. In
the neutral ISM of the MCs we find small deviations from linearity observed as
an overabundance of the $\alpha$-elements Ti, Mg, S and an underabundance of
Mn. The deviations disappear if we assume that all OB stars observed towards
the MCs in our sample have an $\alpha$-element enhancement and Mn
underabundance. This may imply that the MCs have been recently enriched in
$\alpha$-elements, potentially due to recent bursts of star formation. The
observed strong correlations of the depletion sequences of the metals all the
way from low metallicity QSO-DLAs to the Milky Way suggest that cosmic dust has
a common origin, independently of the star formation history, which varies
significantly between these different galaxies. This supports the importance of
grain growth in the ISM as a significant process of dust production.
