If we are using the optional flanking rules, i do not think a player can get advantage from a Dancing Sword, as it is not a character, but will the Dancing Sword get advantage on attacks when flanking WITH another character?
No to both, unless you get liberal with "allies", then yes to both
When a creature and at least one of its allies are adjacent to an enemy and on opposite sides or corners of the enemy's space, they flank that enemy, and each of them has advantage on melee attack rolls against that enemy.
When a creature is where it already falls down, because the Dancing Sword is not a creature. But you might be in luck if you want to stretch the RAW writing of the quote, because it requires 'one creature' and 'allies', and allies are not specifically mentioned as creatures.
So if you can convince your DM that the Dancing Sword is one of your player character's allies, you get the following ruling:
When Bob the Fighter and his Dancing Sword are adjacent to an enemy and on opposite sides or corners of the enemy's space, they flank that enemy, and each of them has advantage on melee attack rolls against that enemy.
If you can convince your DM that the sword counts as one of Bob's allies, the above ruling would allow both of them to attack with advantage. Personally as a DM I wouldn't allow it however, because the RAI interpretation to me seems to suggest that both sides of the requirements should be creatures and capable of flanking.