How do you know if you have cancer that is caused by stress and depression?

Stress/Depression. There is no causal link between stress and depression, but stress certainly lowers your immunity and makes you more susceptible to illnesses.
Unknown if causative. It has not been scientifically proven that stress or depression causes cancer. Some viruses cause cancers so it's possible that stress alters the way a body fights off or deals with viruses and could make one more susceptible to developing cancers. Stress can alter functions of the immune system, perhaps making it harder for the immune system to detect & destroy mutant cells before they reproduce.