We may say «She has a knack for making herself unpopular». It is my opinion that here the speaker defines the «knack». The focus is on «knack».
We may also say «She has the knack of making herself unpopular». It is my opinion that here the speaker assumes that the «knack» exists. The focus is on «she».