The study found an association, and cannot find causation. So it could be that eating more ultra-processed foods leads to a greater risk of depression, or that depression leads to eating more ultra-processed foods, or that something else entirely causes both. The article seems to assume it’s only the first possibility without mentioning the others, which makes me think this is not worth reading.