An O(n^3) Recognition Algorithm for Threshold Dimension 2 Graphs