I saw a lot of code on the web which claimed to do this but for some reason none worked. So here's a small and simple script for the task.
Well it worke-
Tried it with the Yolo_Label tool. Here's an example -
So it probably does
A bit more work is needed to correctly setup the directory structure of the dataset. Refer to the training custom data section in YOLOv5 repository for information about the Darknet dataset structure
Follow a detailed version of doing this from this tutorial