The two chapters give us two accounts of the same events. Judges 4:1–24 gives us the facts, in the typical narrative prose. Judges 5:1–31 then gives us the victory song.
The two chapters “are relatively independent of each other. Judges 5:1–31 is more ancient, for Deborah’s song was composed when the impact of the victory was still fresh in her mind (see Judges 5:1). The author of Judges 4:1–24 no doubt knew the song; but numerous details show that he also consulted other sources, and he in fact did not even include all the material from Judges 5:1–31 in his account. The chapters are therefore complementary."1
1 Then sang Deborah and Barak the son of Abinoam on that day: