How can MongoDB elect a new primary when a datacenter has failed?
You need another replica set member (or arbiter) in a 3rd data center. But if you cannot extend to a 3rd center, then add the 5th member of the replica set to your main data center. Your backup data center will remain with two members. 

If backup data center goes down, main center will stay up and replica set operations will continue.

If main center goes down, replica set operations will be read only and you will need to perform manual intervention.

References: 

Deploy a Geographically Redundant Replica Set

Replica Sets Distributed Across Two or More Data Centers