In both complexes, iron has +2 oxidation state with outer electronic configuration of 3d6 and four unpaired electrons.
In presence of weak filed water ligand, these unpaired electrons do not pair up. However, in presence of strong field cyanide ligand, the unpaired electrons pair up and there are no unpaired electrons.
In two complexes, there is difference in the number of unpaured electrons. This gives rise to different colours.