How do we use the verb 'ban' correctly?

Could you explain to me which of the sentences below is correct and why?

You should ban cars from city centers.
You should ban cars in city centers.

I suppose that the first sentence is a proper one, but I can’t understand why there is a preposition from.

This is an example from an online dictionary, take a look at this:
She was banned from driving for two years.
This case is a coherent one for me.

Maybe there are other similar examples like this above, you mean, a verb + from if you want to express prohibition.

These are two quite separate verbs in terms of meaning. Prevent means stop something happening. There is a saying Prevention is better than cure referring to illness and disease. This means it’s better to stop an illness occurring rather than try and find a cure for it. Prevent is used with the preposition from as in: They were prevented from entering the building by the police - in other words the police didn’t let them go in. Exile means remove someone to another country from their own country. More often this is used as a noun with the expression: live in exile, which can be because you are forced to leave your own country or alternatively because you choose to live in another country.

Hope this helps