Elder’s Melancholy certainly draws its inspiration from an engraving executed by Dürer on the same subject in 1514.
…
A theme often examined in art works since antiquity, melancholy, or melancholia, derives from the medical theory of four humours, whereby disease or ailments were thought to be caused by an imbalance in one or another of the four basic bodily fluids, or humours. In contrast to its negative connotations during the Middle Ages, this condition was equated during the Renaissance with the artistic temperament. In fact, many considered melancholy to be the catalyst for all artistic creation. Cranach makes use of Dürer’s motifs, but transposes them to illustrate one of Martin Luther’s sermons, which aimed to denounce this ailment as an indication that the afflicted individual was under the influence of Satan. Drink and nourishment were essential to counteract its effects.
https://www.musee-unterlinden.com/en/oeuvres/melancholy/