Gauge transformation between retarded and multipolar gauges