I usually see による used as a way to express the cause of something:
There were many people who lost their lives due to the earthquake.
But in some places I see it being used as a way to express dependency on something:
Everything depends on it.
How can I differentiate between those uses?