You might be able to say "I put off seeking medical attention for too long, and it got in the way of doing my job. That was a wake-up call, so I've focused on getting better since then."
Was that the first resume-relevant job you lost because of depression? If so, you can also mention that now you're aware of your medical condition, you're proactively managing it.
If you have been fired from multiple resume-relevant jobs, then don't use the "I learned and won't repeat it" part. In a perfect world, the interviewer should know. Not because you're an immoral worker, but because it's a risk you and your employer would share.
Finally, you "messed up" in the way that a dropped glass hits the floor: no point shaming the glass. Be proud of seeking treatment, but remember there was also luck in that decision. Our ideas of choice and responsibility are more complicated than usual when psychological disorders get mixed in.