Why do you attribute it to NYC’s population density? In general, cities have more crime on average than less densely populated areas of the country.
Logically, assuming all other factors (race, median income, et al) are equal, more densely populated areas ought to have lower per capita crime because even when the number of police per capita are equivalent, the number of cops per square mile is higher, meaning that crooks have a shorter amount of time to do whatever they do, before a police patrol runs into them. For instance, NYC has a police to civilian ratio of 4.22 per 1000, whereas Dallas PD's ratio is 2.44 per 1000. However, NYC's police per square mile ratio is 74 compared to Dallas's 9. I suspect this is in part why Dallas's crime statistics are far worse than NYC's. Areaconnect has an interesting graph illustrating the difference in per capita crime:
Note that the difference in aggravated assaults per capita between Dallas and NYC is smaller than the difference in murders per capita. I suspect that’s also related to population density. An emergency room that is close by prevents aggravated assault from turning into murder. The victim might end up paralyzed from the neck down or limbless, but that would still be classified as assault rather than murder.