Sulphur has an electronic configuration of 2,8,6 with 6 electrons in the outermost shell . Thus it can acquire an oxidation state of S2- by gain of 2 electrons as well as acquire an oxidation state of S6+ by the lose of all the 6 outermost electrons. So it has an oxidation range from -2 to +6.
In the case of H2S, sulphur exists in -2 oxidation state and gain no more electrons and hence cannot behave as an oxidant, hence acts only as a reducing agent. Whereas sulphur exists in +4 oxidation state in SO2 and can gain or lose electrons. Hence, SO2 can behave both as reducing and oxidising agent.