The relation between dissipation and memory in two-fluid displacements in disordered media