The relationship between BMI and body fat is that it really depends on the population and the method of assessing body fat.
Regarding populations, if you compare BMI and body fat among people who are several standard deviations away from average height, the BMI and body fat relationship is very poor; BMI tends to underestimate body fat among taller people and overestimate it among shorter people.
Furthermore, some populations of people tend to have higher body fat percentages at a given BMI than other populations. As such, there is poor correlation between BMI and body fat percentage across different racial, ethnic, and cultural dimensions (Heymsfield et al., 2016).
The relationship between BMI and body fat is affected by the method of assessment, with larger discrepancies being seen among more accurate assessments of body fat. The corollary is also true, with BMI being more correlated with body fat percentage when less accurate methods of assessment are used.
For example, BMI shares a relatively high correlation to body fat percentage when assessed by waist circumference (~r=0.78), but there was a high level of discrepancy observed when body fat was assessed by more precise measures such as DEXA or hydrostatic weighing (Gierach et al., 2014; Shah & Braverman, 2012)