Gluten-free diet and depression in individuals with NON-CELIAC GLUTEN SENSITIVITY
Non-celiac gluten sensitivity refers to intestinal and other symptoms related to the ingestion of gluten in the absence of celiac disease and wheat allergy.
The article from the question mentions few studies in which gluten-free diet was associated with less depression in individuals with non-celiac gluten sensitivity.
Such association was also observed in one 2018 systematic review:
...gluten-free diet (GFD) significantly improved pooled depressive
symptom scores in GFD-treated patients...There was a tendency towards worsening symptoms for non-coeliac gluten
sensitive patients during a blinded gluten challenge vs. placebo.
Gluten-free diet and depression in individuals with CELIAC DISEASE
Gluten-free diet may not necessary reduce depression in those with celiac disease:
In patients on gluten‐free diet, in fact, fatigue tends to be reduced
in intensity while depression seems to persist or even worsen,
supporting recent observations that gluten‐free diet alone fails to
significantly reduce the percentage of CD [celiac disease] patients
affected by depression. (Aliment Pharmacol Ther., 2005)
In celiac disease, depression may not be related directly to the disease pathology:
In coeliac disease, affective disorders should be ascribed to
difficulties in adjusting to the chronic nature of the disease rather
than directly to the disease itself...(Eur J Gastroenterol Hepatol.,
2003)
Diet and depression in GENERAL POPULATION
Six recent systematic reviews about the effect of various diets on depression (2013-1, 2013-2, 2019-1, 2019-2, 2019-3, 2019-4) do not even mention gluten.
In conclusion, there is some evidence about the association between gluten-free diet and reduced depression in some individuals with non-celiac gluten sensitivity but not in others.