The way they've explained it is that immorality is usually based on desire and aversion. And constantly giving in to these things creates a dependence where we're never satisfied with what we have. Having a structured moral code that allows for observing these mental qualities without giving in to them eventually leads to their reduction because we're breaking the habit pattern. Once your desires and aversions are reduced then you become more satisfied with what you have; ie eliminating depression in their case.
Pali terms for anyone interested in the "source code" of the modern Mindfulness Movement that allows you to look up the original Pāli technical terms:
> [unskilful] desire
taṇhā (The second Noble Truth)
> aversion
dosa
> we're never satisfied
dukkha (The first Noble Truth)
> moral code
sīla