The international rugby Hall of Fame member says Hansen - who coached the men in red from 2002 - 2004 - faced a tough task whipping Wales into shape back then.
The 40-year-old Williams described Hansen as something of a dictator, while Gatland was more interested in what players believed.
Williams writes: "The famous episode with Dayfdd James said a lot about his man-management style. Steve wanted players to stay in the team hotel but Daf sneaked home for the night and returned early the next morning. A former policeman, Steve went out to Daf's car, checked the engine was warm and that was that - case closed.
"In fairness, Welsh rugby was in a bit of a state at the time and we all needed to be a bit more switched on. Attitudes needed to be different and so maybe Steve had to make us more disciplined."
Williams is a fan of both men, but says "Gats was hugely approachable...and was actually prepared to accept advice."
In contrast, "...with Hansen, there was always the sense that he would have the final say. He had a dry sense of humour but took no messing".
In media dealings, Williams thought Gatland "wears his heart more on his sleeve than Hansen".
Both were extremely protective of players. Williams also talked up the importance of media dealings, saying that a coach with a confident air was vital.
Williams suggested the Welsh players struggled at first with Hansen's blackboard sessions and love of the pod systems, but said players still talk about how much they improved under him.
Gatland had the advantage of inheriting a more mature squad, and relied on trusted deputies who quickly brought results.
"People have accused him (Gatland) of being slow to change over the years, but he devised game plans to suit the strengths of his players and, compared with much else over the previous 30 years, he's been successful," Williams writes.
"Hansen was never afraid to go against the grain of public opinion. He's still like that with New Zealand. Gats is his own man in selection too, bold and always willing to grasp the nettle. He is another who doesn't court popularity with his picks."
As for the verdict, Williams says: "It's a hell of a tight call as to who is the better coach...(they are) probably the two best international coaches I played under.
"I learned a lot more about myself under Steve Hansen...making me realise what test rugby involved. A heart-to-heart with him was like having cold water splashed in your face.
"But pretty much every player remembers fondly the coach he played under at the high point in his career and I am no different. I played my best rugby for Wales under Warren
Gatland and the side we had in 2008 was a heck of a team.
"Would Gatland have been as successful as Hansen had he coached the All Blacks these past five years? There's every chance he would have been. This weekend they will be trying to outdo each other again and their battle will almost be as interesting as the one on the pitch."