How to choose from DI or DA preposition

Each preposition can play different functions. Different prepositions have similar uses.
In other cases, it is the verb, noun or adjective that determines the preposition to be used.
The basic function of a preposition is to introduce some additional information to a verb or a noun, in the form of a complement.
But how to choose from Di or Da preposition?