Your example varies based on the context. And there is no general rule since "zu" and "mit" (especially "zu") have different meanings if they are adverb, preposition or anything else.
If we look at
Der Gegenstand stand in Verbindung mit dem Fall.
There "Verbindung mit" means that the object was connected with the case. But another example with "mit":
In Verbindung mit Sauerstoff ist Wasserstoff gefährlich.
This expresses that oxygen is dangerous in combination with hydrogen.
And the same problem occurs with "zu":
Sie hatte eine Verbindung zu einem WLAN-Netzwerk.
This expresses (again) a connection (she was connected to a WiFi). But of course there's also another meaning:
H und O2 gingen eine Verbindung zu H2O ein.
That sentence expresses a link. And there are more example for "mit" and for "zu". But as stated at the beginning that really depends on the context and especially on the substantive.