I think there might be a causal relationship both ways with sleep and depression in teenagers (speaking as a qualified software engineer)-- and one of the first things the psychiatrist had us / the teenager do was make sure that he had good sleep
habits (e.g. your bed is only for sleeping, go to bed at a decent hour, watch out for
caffeine in the hours before bedtime,
regular stuff).