It could easily be both, though there certainly is research indicating depression causes physical pain. However since many of these studies only found correlations it's only clear that they come together and not whether one causes the other. One way of isolating that issue would be to determine the rates of depression in people with unambiguously diagnosable chronic pain disorders due to a root physical cause vs both the population and the population of those who report chronic pain.