I wouldn't say attack is the right word. Depression seems to be an evolved mechanism that has developed in the brain, as a way to change the organism's behaviour, e.g. resting while sick (sickness behaviour depression), getting more sleep, getting out of a stressful situation, etc. The problem is, it's more like a generic "check engine" light, but without having access to an OBD, so you kinda have to look at your lifestyle and try to figure out what's causing the depression, which isn't always easy.